package us.mooresr.webtroopmanager.client.place;

import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;



public class EditRolePlace extends Place {
	private Long roleId;
	
	public EditRolePlace(Long roleId) {
		this.roleId = roleId;
	}
	
	public Long getRoleId() {
		return roleId;
	}
	
	public static class Tokenizer implements PlaceTokenizer<EditRolePlace> {

		@Override
		public EditRolePlace getPlace(String token) {
			Long roleId;
		
			if ((token == null) || (token.equals("null")))  {
				roleId = null;
			} else {
				roleId = Long.parseLong(token);
			}
			
			return new EditRolePlace(roleId);
		}

		@Override
		public String getToken(EditRolePlace place) {
			Long roleId;
			
			roleId = place.getRoleId();
			if (roleId == null) {
				return null;
			} else {
				return roleId.toString();
			}
		}
		
	}

}
